package com.xiangdao.service;

import com.xiangdao.dao.ShareProductDao;
import com.xiangdao.model.ShareProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class ShareProductService {
    @Autowired
    ShareProductDao shareProductDao;


    /**
     * 添加数据
     * @param shareProduct
     * @return
     */
    public int addShareProduct(ShareProduct shareProduct){
        return shareProductDao.addProduct(shareProduct);
    }


    /**
     * 删除产品
     * @param id
     */
    public void deleteProductById(Integer id){
         shareProductDao.deleteProductById(id);
    }

    /**
     * 根据标题模糊查询
     * @param title
     * @return
     */
    public ArrayList<ShareProduct> selectAllShareProduct(String title){
        return shareProductDao.selectAllShareProduct(title);
    }

    public ArrayList<ShareProduct> findAllProduct(){
        return shareProductDao.findAllProduct();
    }


    public ArrayList<ShareProduct> findAllProductByPrice(){
        return shareProductDao.findAllProductByPrice();
    }


}
